#pragma once

#include <QtCore/qglobal.h>

#ifdef COMMONCTRL_LIB
# define COMMONCTRL_EXPORT Q_DECL_EXPORT
#else
# define COMMONCTRL_EXPORT Q_DECL_IMPORT
#endif

#include <QObject>
#include <QWidget>
class COMMONCTRL_EXPORT QDirectButton : public QWidget
{
	Q_OBJECT
public:
	QDirectButton(QWidget* parent = 0);
	~QDirectButton(void);

protected:
	int			getFocusIndex(const QPoint&);
	void		mouseMoveEvent(QMouseEvent *e);
	void		mousePressEvent(QMouseEvent *e);
	void		mouseReleaseEvent(QMouseEvent *e);
	void		paintEvent(QPaintEvent *e);
private:
	QPolygon	polygon[8];
	bool		m_bPress;
	bool		m_bMove;
	int			m_nCurIndex;
signals:
	void		onDirectBtnIndexSignal(int );
};

